package parser;

import java.io.FileNotFoundException;
import java.util.List;

import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

abstract class ASTAbsolutePath extends MySimpleNode
{
	String fileName;

	public ASTAbsolutePath(int id)
	{
		super(id);
	}

	public ASTAbsolutePath(XQueryParser p, int id)
	{
		super(p, id);
	}

	public Document getDoc(String fileName)
	{
		DOMParser p = new DOMParser();
		try
		{
			p.parse(fileName);
		} catch (FileNotFoundException e)
		{
			errorExit("The file \"" + fileName
					+ "\" cannot be opened.\n Check that it exists.");
		} catch (Exception e)
		{
			e.printStackTrace();
		}
		return p.getDocument();
	}
	

	public String toString(String prefix)
	{
		String baseName = prefix + toString();
		return baseName + "\n" + prefix + " " + fileName;
	}

	public abstract List<Node> process(Document d);
	
	


}
